package datasv.collegeQuery_datasv;

import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import data.datafactory.DatabaseOperator;
import datasv.teacherQuery_datasv.TeacherQueryDatasvController;
import po.CollegeTeacherListPO;
import po.TeacherPO;

public class GetTeacherPOList {
	public static void main(String[] args) {
		System.out.println(new GetTeacherPOList().getTeacherList("001"));
//		System.out.println(new GetTeacherPOList().getTeacherList("001"));
//		System.out.println(new GetTeacherPOList().getTeacherList("001"));
	}
	public  List<TeacherPO> getTeacherList(String collegeID){
		return getInSql(collegeID);
	}
	public List<TeacherPO> getInSql(String collegeID){
		ArrayList<TeacherPO> list=new ArrayList<TeacherPO>();
		DatabaseOperator op=new DatabaseOperator("college");
		if(!op.ifIDExist("college_list", collegeID)){
			return list;
		}
		ArrayList<String[]> id=op.getTeacherPOList(collegeID);
		for (int i = 0; i < id.size(); i++) {
			String[] m=id.get(i);
			int[] n={Integer.parseInt(m[2].split("/")[0]),Integer.parseInt(m[2].split("/")[1]),Integer.parseInt(m[2].split("/")[2])};
			list.add(new TeacherPO(m[0],m[1],m[3],Integer.parseInt(m[4]),new Date(n[0],n[1],n[2])));
		}
		return list;
	}
}
